From: Debarshi Ray Date: Thu, 9 Jan 2014 14:36:41 +0000 (+0100) Subject: appDisplay: Special case terminal launching X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~2938 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=68faba6bde08a88989418df7861563eb458567bd;p=gnome-shell.git appDisplay: Special case terminal launching One of the most frequent complaints about our launching behaviour is how we handle terminals. Among all MDI applications, the terminal is the one that is most likely to have lots of semi-independent windows opened at the same time, and spawning new windows is much more common. More so, if it does not support tabs. Therefore, we special case terminal launchers to always create a new window. It is an application that most non-technical users will not use, so chances of them being confused by any special behaviour is expected to be low. https://bugzilla.gnome.org/show_bug.cgi?id=695010 --- diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index cdd1e1aa6..1a04fdab8 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -47,6 +47,10 @@ const INDICATORS_ANIMATION_MAX_TIME = 0.75; const PAGE_SWITCH_TRESHOLD = 0.2; const PAGE_SWITCH_TIME = 0.3; +function _isTerminal(app) { + return app.get_app_info().get_categories().indexOf('TerminalEmulator') > -1; +}; + // Recursively load a GMenuTreeDirectory; we could put this in ShellAppSystem too function _loadCategory(dir, view) { let iter = dir.iter(); @@ -913,7 +917,7 @@ const AppSearchProvider = new Lang.Class({ let app = this._appSys.lookup_app(result); let event = Clutter.get_current_event(); let modifiers = event ? event.get_state() : 0; - let openNewWindow = modifiers & Clutter.ModifierType.CONTROL_MASK; + let openNewWindow = (modifiers & Clutter.ModifierType.CONTROL_MASK) || _isTerminal(app); if (openNewWindow) app.open_new_window(-1); @@ -1448,8 +1452,9 @@ const AppIcon = new Lang.Class({ _onActivate: function (event) { let modifiers = event.get_state(); - if (modifiers & Clutter.ModifierType.CONTROL_MASK - && this.app.state == Shell.AppState.RUNNING) { + if ((modifiers & Clutter.ModifierType.CONTROL_MASK + && this.app.state == Shell.AppState.RUNNING) + || _isTerminal(this.app)) { this.app.open_new_window(-1); } else { this.app.activate();